# Maintainer: Alexey Pavlov <alexpux@gmail.com>

pkgname=swig
pkgver=4.0.1
pkgrel=1
pkgdesc="Generate scripting interfaces to C/C++ code"
arch=('i686' 'x86_64')
url="http://www.swig.org/"
license=('custom')
groups=('base-devel')
depends=('zlib' 'libpcre')
makedepends=('zlib-devel' 'pcre-devel')
source=(https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz
        swig-4.0.0-msysize.patch)
sha256sums=('7a00b4d0d53ad97a14316135e2d702091cd5f193bb58bcfcd8bc59d41e7887a9'
            'e5499ba5ec6e10f3de3a49a26ea22ca16f81cde3b7ec543d959f0f2096b03543')

prepare() {
  cd ${pkgname}-${pkgver}

  patch -p1 -i ${srcdir}/swig-4.0.0-msysize.patch

  ./autogen.sh
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure -build=${CHOST} --prefix=/usr
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -D -m644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
  install -D -m644 LICENSE-UNIVERSITIES "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE-UNIVERSITIES
}
